import { App } from 'vue';

export interface TableConfigType {
  url: string;
  query?: { [key: string]: any };
  border?: boolean;
  index?: boolean;
  check?: boolean;
  toolsWidth?: number;
  toolsFixed?: string;
  tools?: boolean;
}

export interface BaseColumnType {
  name: string;
  prop: string;
  label: string;
  align: string;
  fixed?: string;
  width?: string | number;
  minWidth?: string | number;
  formatter?(val: any): any;
}

export interface ClickColumnType extends BaseColumnType {
  handle(row: any): void;
}

export interface SwitchColumnType extends BaseColumnType {
  handle(page: App, row: { [key: string]: any }): void;
  acriveColor?: string;
  inactiveColor?: string;
}

export interface JumpColumnType extends BaseColumnType {
  jumpType: string;
  jumpPath: string;
}

export interface TagsColumnType extends BaseColumnType {
  beforeFormatter?(val: string): string[]; // 渲染之前预处理
}
